package com.mjk.manager.api.constns;

import java.util.Date;
import java.util.List;
import java.util.Set;


import com.mjk.common.tools.properties.annotation.BeeProperties;
import lombok.Data;

/**
 * apipost 动态接口生成 用于文档生成功能
 * @author Administrator
 *
 */
@Data
@BeeProperties(propertiefix = "apipost")
public class ApiPostProperties {
	private String url ;
	/**
	 * 用户api_token
	 */
	private String apiToken;
	/**
	 * 项目id
	 */
	private String projectId;
	
	public enum ApiPostTypeTransferEnum {
		LIST(List.class,"Array"),
		SET(Set.class,"Array"),
		DATE(Date.class,"Date"),
		STRING(String.class,"String"),
		LONG(Long.class,"Number"),
		DOUBLE(Double.class,"Number"),
		FLOAT(Float.class,"Float"),
		INTEGER(Integer.class,"Integer")
		;
		private final Class<?> clazz;
		private final String type;
		ApiPostTypeTransferEnum(Class<?> clazz,String type){
			this.clazz = clazz;
			this.type = type;
		}
		
		public static String transferType(Class<?> clazz) {
			ApiPostTypeTransferEnum[] ary = values();
            for (ApiPostTypeTransferEnum apiPostTypeTransferEnum : ary) {
                if (clazz.equals(apiPostTypeTransferEnum.clazz)) {
                    return apiPostTypeTransferEnum.type;
                }
            }
			return ApiPostTypeTransferEnum.STRING.type;//默认为string
		}
	}
}
